<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var arr = [8, 21, 4, 82, 93, 54, 25, 65, 3, 41]
        for (var i = 0; i < arr.length - 1; i++) {
            var min = i
            for (var j = i + 1; j < arr.length; j++) {
                if (arr[min] > arr[j]) {
                    min = j
                }
            }
            var tmp = arr[i]
            arr[i] = arr[min]
            arr[min] = tmp
        }
        console.log(arr)
    </script>
</body>

</html>